﻿using Columbus.Controls;

namespace Columbus.ActionResults
{
    /// <summary>
    /// 'Do nothing' result is returned to keep navigation frame content as is
    /// </summary>
    public class DoNothingResult : ActionResult
    {
        private readonly Frame navigationFrame;

        /// <summary>
        /// Initializes a new instance of the <see cref="DoNothingResult"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        public DoNothingResult(NavigationContext context) 
            : base(context)
        {
            navigationFrame = context.Navigator.NavigationFrame;
        }

        /// <summary>
        /// Executes result.
        /// </summary>
        protected override void ExecuteInternal()
        {
            Dispatcher.Dispatch(() => navigationFrame.IsContentEnabled = true);
        }
    }
}